#ifndef _ROB_TELEMETRY_H
#define _ROB_TELEMETRY_H

#include <WProgram.h>
#include <avr/io.h>



// Telemetry down commands
#define ID_TELEMETRY 0x01



//bit fileds for tmy.actorEnablers
#define TMY_ENA_DN      0x00 // enable telemetry downstream
#define TMY_ENA_IRBAR   0x01 
#define TMY_ENA_PING    0x02
#define TMY_ENA_CAM     0x03
#define TMY_ENA_FAVS    0x04
#define TMY_ENA_CAVS    0x05

struct struTelemetry {

  byte cmd;

  // sensors
  byte engineLSpeed;
  byte engineRSpeed;
  byte servoPanPos;
  byte servoTiltPos;
  byte ir1Distance;
  byte ir2Distance;
  byte ir3Distance;
  byte ir4Distance;
  byte ir5Distance;
  byte irMaxDistance;
  byte pingDistance;
  byte batteryStatus;
  byte btnStatus;
  byte load;

  // actors
  byte actorEnablers;  
  byte engineLPower;
  byte engineRPower;
  byte engineDirections;
  byte servoTiltTargetPos;
  byte servoPanTargetPos;
  byte btnCZHandler;
  byte lightSystem;

  // commanders
  byte mocsTurn;
  byte mocsDriveSec;
  byte soundPlay;

};


class CTelemetry {

public:
  void Begin(void);
  void save(void);
  void load(void);

};


extern struTelemetry tmy;
extern CTelemetry Telemetry;


#endif // _ROB_TELEMETRY_H

